package com.zlj.jdbc.transfer.jdbcUtils03;

import java.sql.SQLException;

import org.junit.Test;

public class TestDemo {
	private AccountDao dao = new AccountDao();
	
	@Test
	public void test01() throws SQLException {
		try {
			JdbcUtils.beginTransaction();
			dao.update("ls", -100);
			
	     	if(true) {
				throw new SQLException();
			}
			
			dao.update("zs", 100);
			JdbcUtils.commitTransaction();
		} catch (SQLException e) {
			JdbcUtils.rollbackTransaction();
			throw e;
		}
	}
}
